import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home/index.vue'
import index from './views/index/index/index.vue'
import myhome from './views/index/myhome/index.vue'
import login from './views/login/index/index.vue'
import u404 from './views/u404/index.vue'
import organization from './views/organization/index/index.vue'
import classroom from './views/organization/classroom/index.vue'
import user from './views/organization/user/index.vue'
import role from './views/organization/role/index.vue'
import wactchrole from './views/organization/wactchrole/index.vue'
import course from './views/educational/course/index.vue'
import clazz from './views/educational/clazz/index.vue'
import clazzstudent from './views/educational/clazzstudent/index.vue'
import student from './views/educational/student/index.vue'
import teachingschedule from './views/educational/teachingschedule/index.vue'
import itembankgroup from './views/educational/itembankgroup/index.vue'
import itembank from './views/educational/itembankgroup/info.vue'
import settime from './views/educational/settime/index.vue'
import setfestival from './views/educational/setfestival/index.vue'
import classhour from './views/educational/classhour/index.vue'
import watchtudent from './views/educational/watchtudent/index.vue'
import clazzschedule from './views/educational/clazzschedule/index.vue'
import signinforclass from './views/classisover/signinforclass/index.vue'
import classsignin from './views/classisover/classsignin/index.vue'
import classevaluation from './views/classisover/classevaluation/index.vue'
import jobsubmission from './views/classisover/jobsubmission/index.vue'
import homework from './views/classisover/homework/index.vue'
import addhomework from './views/classisover/addhomework/index.vue'
import watchhomework from './views/classisover/watchhomework/index.vue'
import watchstudenthomework from './views/classisover/watchstudenthomework/index.vue'
import checkclassevaluation from './views/classisover/checkclassevaluation/index.vue'
import announcement from './views/announcementpush/announcement/index.vue'
import sendingannouncement from './views/announcementpush/sendingannouncement/index.vue'
import watchannouncement from './views/announcementpush/watchannouncement/index.vue'
import businessprofile from './views/statisticalanalysis/businessprofile/index.vue'
import educationalstatements from './views/statisticalanalysis/educationalstatements/index.vue'

Vue.use(Router)
import { get } from 'jquery'
export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/index',
      name: '首页',
      redirect: { name: '机构首页' },
      component: Home,
      props: true,
      children: [
        {
          path: '/myhome',
          name: '个人中心',
          component: myhome,
        },
        {
          path: '/home',
          name: '机构首页',
          component: index,
        },
        {
          path: '/organization',
          name: '组织架构',
          component: organization,
        },
        {
          path: '/classroom',
          name: '教室',
          component: classroom,
        },
        {
          path: '/user',
          name: '员工',
          component: user,
        },
        {
          path: '/roles',
          name: '机构角色',
          component: role,
        },
        {
          path: '/role/:ID',
          name: '查看角色',
          component: wactchrole,
          props: true
        },
        {
          path: '/course',
          name: '课程',
          component: course,
        },
        {
          path: '/clazz',
          name: '班级',
          component: clazz,
        },
        {
          path: '/clazz/student/:ID',
          name: '班级学员',
          component: clazzstudent,
          props: true
        },
        {
          path: '/student',
          name: '学员',
          component: student,
        },
        {
          path: '/teachingschedule',
          name: '排课',
          component: teachingschedule,
        },
        {
          path: '/itembankgroup',
          name: '题库组',
          component: itembankgroup,
        },
        {
          path: '/itembank/:ID',
          name: '题库详情',
          component: itembank,
          props: true
        },
        {
          path: '/settime',
          name: '上课时间设置',
          component: settime,
        },
        {
          path: '/setfestival',
          name: '节假日设置',
          component: setfestival,
        },
        {
          path: '/classhour/:ID',
          name: '课时管理',
          component: classhour,
          props: true,
        },
        {
          path: '/watchtudent/:ID',
          name: '学员课程详情',
          component: watchtudent,
          props: true,
        },
        {
          path: '/clazzschedule/:ID',
          name: '课程安排',
          component: clazzschedule,
          props: true,
        },
        {
          path: '/signinforclass',
          name: '上课签到',
          component: signinforclass,
        },
        {
          path: '/classsignin/:ID',
          name: '班级签到',
          component: classsignin,
          props: true
        },
        {
          path: '/classevaluation/:time',
          name: '下课点评',
          component: classevaluation,
          props: true
        },
        {
          path: '/checkclassevaluation/:ID',
          name: '查看下课点评',
          component: checkclassevaluation,
          props: true
        },
        {
          path: '/homework',
          name: '课后作业',
          component: homework,
        },
        {
          path: '/addhomework',
          name: '布置作业',
          component: addhomework,
        },
        {
          path: '/jobsubmission/:ID',
          name: '作业提交详情',
          component: jobsubmission,
          props: true,
          redirect: { name: '布置作业详情' },
          children: [
            {
              path: 'watchhomework',
              name: '布置作业详情',
              component: watchhomework,
            },
            {
              path: 'watchstudenthomework/:ids',
              name: '查看学生作业',
              component: watchstudenthomework,
              props: true,
            },
          ]
        },
        {
          path: '/announcement',
          name: '通知公告',
          component: announcement,
          props: true
        },
        {
          path: '/sendingannouncement',
          name: '创建通知公告',
          component: sendingannouncement,
        },
        {
          path: '/watchannouncement/:ID',
          name: '通知公告详情',
          component: watchannouncement,
          props: true
        },
        {
          path: '/businessprofile',
          name: '经营概况',
          component: businessprofile,
        },
        {
          path: '/educationalstatements',
          name: '教务报表',
          component: educationalstatements,
        },
      ]
    },
    {
      path: '/login',
      name: '登陆',
      component: login
    },
    {
      path: '/logout',
      name: '退出',
      beforeEnter: function (to, from, next) {
        get("/user/logout")
        next("/login")
        window.location.reload()
      }
    },
    {
      path: '*',
      name: '404',
      component: u404
    }
  ]
})
